<?php
class Administrator_label_model extends CI_Model {

    function __construct()
    {
        parent::__construct();
    }	
	
	/*Content Management*/
	function content_management_add()
	{
		$label_name = $this->input->post('label_name');
		$datetime = date('Y-m-d H:i:s');
		
		//Insert label_content
		$data = array(
			'label_name' => $label_name,
			'update_by' => $this->session->userdata('username'),			
			'create_date' => $datetime,
			'update_date' => $datetime
		);
		$this->db->insert('label',$data);
	}
	
	function content_management_edit($label_id)
	{
		$label_name = $this->input->post('label_name');
		$datetime = date('Y-m-d H:i:s');
		
		//Update label_content
		$data = array(
			'label_name' => $label_name,
			'update_by' => $this->session->userdata('username'),			
			'update_date' => $datetime
		);
		$this->db->update('label',$data,array('label_id' => $label_id));				
	}	
	
	function content_management_delete()
	{
		$id = $this->input->post('id');
		foreach($id as $value):
			$tables = array('label');
			$this->db->where('label_id', $value);
			$this->db->delete($tables);			
		endforeach;			
	}
}

?>